//
//  FeedBackViewController.m
//  XRSquare
//
//  Created by 穆相臣 on 2018/9/2.
//  Copyright © 2018年 UaenaMo. All rights reserved.
//

#import "FeedBackViewController.h"

@interface FeedBackViewController ()
{
    UITextField * titleTextField;
    UITextField * contentTextField;
}
@end

@implementation FeedBackViewController

-(void)backAction
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBarHidden = NO;
    self.navigationController.navigationBar.tintColor = [UIColor grayColor];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];
    self.navigationItem.title = @"意见反馈";
    
    CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
    CGRect rectNav = self.navigationController.navigationBar.frame;
    
     titleTextField = [[UITextField alloc]initWithFrame:CGRectMake(20, rectNav.size.height + rectStatus.size.height + 50, ScreenWidth - 40, 30)];
    titleTextField.placeholder = @"请输入标题";
    [self.view addSubview:titleTextField];
    
    UIView * line2 = [[UIView alloc]initWithFrame:CGRectMake(20, rectNav.size.height + rectStatus.size.height + 80, ScreenWidth - 40, 1)];
    line2.backgroundColor = [UIColor colorFromHexCode:@"f3f3f3"];
    [self.view addSubview:line2];
    
    contentTextField = [[UITextField alloc]initWithFrame:CGRectMake(20, rectNav.size.height + rectStatus.size.height + 80 + 50, ScreenWidth - 40, 30)];
    contentTextField.placeholder = @"请输入内容";
    [self.view addSubview:contentTextField];
    
    UIView * line3 = [[UIView alloc]initWithFrame:CGRectMake(20, rectNav.size.height + rectStatus.size.height + 80 + 80, ScreenWidth - 40, 1)];
    line3.backgroundColor = [UIColor colorFromHexCode:@"f3f3f3"];
    [self.view addSubview:line3];
    
    UIButton * next = [[UIButton alloc]initWithFrame:CGRectMake(20, rectNav.size.height + rectStatus.size.height + 80 + 80 + 50, ScreenWidth - 40, 30)];
    next.layer.borderColor = [UIColor orangeColor].CGColor;
    next.layer.borderWidth = 1;
    next.layer.cornerRadius = 15;
    [next setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
    [next setTitle:@"保存" forState:UIControlStateNormal];
    [next addTarget:self action:@selector(nextAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:next];
}

-(void)nextAction
{
    [NetRequestCenter delprivatewithtitle:titleTextField.text content:contentTextField.text result:^(BOOL success, NSDictionary *resultDic) {
        if (success) {
            
            [SVProgressHUD showSuccessWithStatus:@"提交成功"];
            [self.navigationController popViewControllerAnimated:YES];
        }
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
